﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MyAdmin/QuanLy.master" AutoEventWireup="true" CodeFile="LoaiSanPham_AM.aspx.cs" Inherits="MyAdmin_LoaiSanPham_AM" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <fieldset>
 <legend align="center" color="#F3CFB5">
     <b>Loại Sản Phẩm</b></legend>  
     <table border="0" cellspacing="0" cellpadding="0" width="100%">
     	<tr>
     		<td align="center">
               <asp:DetailsView ID="dtvLoaiSanPham" runat="server" AutoGenerateRows="False" 
            BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" DataKeyNames="ID" DataSourceID="LQDSLoaiSanPham" 
            GridLines="Vertical" HeaderText="Loại Sản Phẩm" Height="50px" Width="50%" 
            oniteminserted="dtvLoaiSanPham_ItemInserted" 
            onitemupdated="dtvLoaiSanPham_ItemUpdated">
            <AlternatingRowStyle BackColor="#DCDCDC" />
            <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            <Fields>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" />
                <asp:BoundField DataField="Name" HeaderText="Tên" SortExpression="Name" />               
                 <asp:TemplateField HeaderText="Hình">
                    <ItemTemplate>
                        <asp:Label ID="hinhLABEL" runat="Server" Text='<%# Eval("Hinh") %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="lblUpdloadForEdit" runat="server" Text="Upload Hình:" ForeColor="White"></asp:Label>
                        <asp:FileUpload ID="fuForEdit" runat="server" />
                        <asp:Button ID="btnUploadForEdit" runat="server" Text="Upload" OnClick="btnUploadForEdit_Click" />
                        <asp:TextBox ID="txtUploadForEdit" ReadOnly="true" Text='<%# Bind("Hinh") %>' runat="server"></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                     <asp:TemplateField HeaderText="Chủng loại sản phẩm">
                    <ItemTemplate>
                        <asp:Label ID="lblTenCLSP" runat="server" Text='<%# Eval("TenCLSP") %>'/>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtTenCLSP" Visible="false" runat="server" ReadOnly="true" Text='<%# Bind("MaChungLoaiSP") %>'/>
                        <asp:DropDownList ID="cbbLSP" runat="server" AutoPostBack="True" DataSourceID="LQDSChungLoaiSP"
                            DataTextField="Ten" DataValueField="ID" HeaderText="Chủng loại sản phẩm" 
                            ondatabound="cbbLSP_DataBound" 
                            onselectedindexchanged="cbbLSP_SelectedIndexChanged">
                        </asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField DataField="DaXoa" HeaderText="Đã Xóa" 
                    SortExpression="DaXoa" />
                <asp:CommandField CancelText="Hủy" EditText="Cập Nhật" InsertText="Thêm" 
                    NewText="Thêm" ShowEditButton="True" ShowInsertButton="True" 
                    UpdateText="Cập Nhật" />
            </Fields>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" 
                HorizontalAlign="Center" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        </asp:DetailsView>
          <asp:Label runat="server" Text="Label" ID="lblThongBaoDTView" ForeColor="White" Visible="false"/>
            </td>
     	</tr>
     </table>

    
        <br />
        <asp:GridView ID="gvDSLoaiSanPham" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" 
            BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="ID" GridLines="Vertical" 
            onpageindexchanged="gvDSLoaiSanPham_PageIndexChanged" 
            onpageindexchanging="gvDSLoaiSanPham_PageIndexChanging" 
            onselectedindexchanged="gvDSLoaiSanPham_SelectedIndexChanged" Width="100%">
            <AlternatingRowStyle BackColor="#DCDCDC" />
            <Columns>
                <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
                <asp:ImageField DataImageUrlField="Hinh">
                    <ControlStyle Height="100px" Width="100px" />
                </asp:ImageField>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" />
                <asp:BoundField DataField="Name" HeaderText="Tên" SortExpression="Name" />
                <asp:BoundField DataField="TenCLSP" HeaderText="Chủng Loại Sản Phẩm" 
                    SortExpression="TenCLSP" />
                <asp:CheckBoxField DataField="DaXoa" HeaderText="Đã Xóa" 
                    SortExpression="DaXoa" ReadOnly="True" />
                    <asp:TemplateField>
                <ItemTemplate>
                    <asp:CheckBox ID="checkXoa" runat="server" AutoPostBack="True" />
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
            <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#0000A9" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#000065" />
        </asp:GridView>
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
        	<tr>
        		<td align="right">
                  <asp:Label ID="lblThongBaoGridView" runat="server" ForeColor="White" Text="Label"></asp:Label>
                  <asp:Button ID="XoaNhieuBUTTON" runat="server" Text="Xóa Đã Chọn" 
            onclick="XoaNhieuBUTTON_Click" />          
                </td>
        	</tr>
        </table> 
        <asp:LinqDataSource ID="LQDSLoaiSanPham" runat="server" 
            ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext" 
            EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName="" 
            TableName="Categories" oninserted="LQDSLoaiSanPham_Inserted" 
            onselecting="LQDSLoaiSanPham_Selecting" onupdating="LQDSLoaiSanPham_Updating">
        </asp:LinqDataSource>
          <asp:LinqDataSource ID="LQDSChungLoaiSP" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
            EntityTypeName="" Select="new (ID, Ten)" TableName="ChungLoaiSPs">
        </asp:LinqDataSource>
      

 </fieldset>
</asp:Content>

